#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QSerialPort>
#include <QTimer>
#include <QMessageBox>
#include <QVector>
class QLabel;
class QComboBox;
class QSpinBox;
class QLineEdit;
class QPushButton;

class Dialog : public QDialog
{
    Q_OBJECT
public:
    explicit Dialog(QWidget *parent = nullptr);

private slots:
    // 发送
    void sendRequest();
    // 响应
    void readResponse();
    void processTimeout();

signals:
    void sendData(QString);
private:
    int m_transactionCount = 0;
    QLabel *m_waitResponseLabel = nullptr;
    QSerialPort m_serial;
    QByteArray m_response;
    QTimer m_timer;
    QTimer pTimer;
    QVector<QSerialPort> m_serialList;


    int i=0;
    QString data="";

    QList<QByteArray> DataMsg;
    void initData();

    bool isRealBound();

};

#define DialogRelease Singleton<Dialog>::Release()

#define DialogInstance Singleton<Dialog>::GetInstance()

#endif // DIALOG_H
